home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / marque / marquee.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  2.1 KB  |  70 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Marquee Demo"
  5.    ClientHeight    =   2775
  6.    ClientLeft      =   1935
  7.    ClientTop       =   1485
  8.    ClientWidth     =   5520
  9.    Height          =   3180
  10.    Left            =   1875
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   2775
  14.    ScaleWidth      =   5520
  15.    Top             =   1140
  16.    Width           =   5640
  17.    Begin CommandButton Command2 
  18.       Caption         =   "Exit"
  19.       Height          =   495
  20.       Left            =   2760
  21.       TabIndex        =   2
  22.       Top             =   2040
  23.       Width           =   975
  24.    End
  25.    Begin CommandButton Command1 
  26.       Caption         =   "Marquee"
  27.       Height          =   495
  28.       Left            =   1560
  29.       TabIndex        =   1
  30.       Top             =   2040
  31.       Width           =   975
  32.    End
  33.    Begin PictureBox Picture1 
  34.       AutoRedraw      =   -1  'True
  35.       BackColor       =   &H00FFFF00&
  36.       ForeColor       =   &H000000FF&
  37.       Height          =   1335
  38.       Left            =   120
  39.       ScaleHeight     =   1305
  40.       ScaleWidth      =   5265
  41.       TabIndex        =   0
  42.       Top             =   360
  43.       Width           =   5295
  44.    End
  45. Sub Command1_Click ()
  46. '*NOTE: Picture 1 has AutoRedraw set True
  47. '*Fore and Back Color are set in VB
  48. '* Setup string and print formatting.
  49. marquee$ = "It's EASY to do a simple Marquee in VB!"
  50. picture1.fontname = "Helv"
  51. picture1.fontsize = 48
  52. picture1.fontbold = -1
  53. thewidth = picture1.TextWidth(marquee$)
  54. '*Add spaces for repeat when string scrolls off
  55. Do While picture1.TextWidth(marquee$) < picture1.scalewidth + thewidth
  56.     marquee$ = marquee$ + " "
  57. '*Display the moving marquee
  58.     For x& = 1 To Len(marquee$)
  59.         a$ = Mid$(marquee$, 1, x&)
  60.         picture1.currentx = picture1.scalewidth - picture1.TextWidth(a$)
  61.         picture1.Print a$;
  62.         '*DoEvents() is required!
  63.         q = DoEvents()
  64.         '*Erases old string. AutoRedraw prevents flashing
  65.         picture1.Cls
  66.     Next
  67. End Sub
  68. Sub Command2_Click ()
  69. End Sub
  70.